package com.interview.lock;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 消息实体类
 * 
 * 用于在生产者和消费者之间传递的消息对象
 */
public class Message implements Serializable {
    private static final long serialVersionUID = 1L;
    
    // 消息ID
    private long id;
    // 生产者ID
    private int producerId;
    // 消息内容
    private String content;
    // 消息创建时间
    private LocalDateTime createTime;
    
    public Message() {
    }
    
    public Message(long id, int producerId, String content) {
        this.id = id;
        this.producerId = producerId;
        this.content = content;
        this.createTime = LocalDateTime.now();
    }
    
    // Getters and Setters
    public long getId() {
        return id;
    }
    
    public void setId(long id) {
        this.id = id;
    }
    
    public int getProducerId() {
        return producerId;
    }
    
    public void setProducerId(int producerId) {
        this.producerId = producerId;
    }
    
    public String getContent() {
        return content;
    }
    
    public void setContent(String content) {
        this.content = content;
    }
    
    public LocalDateTime getCreateTime() {
        return createTime;
    }
    
    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }
    
    @Override
    public String toString() {
        return "Message{" +
                "id=" + id +
                ", producerId=" + producerId +
                ", content='" + content + '\'' +
                ", createTime=" + createTime +
                '}';
    }
}

